package myJs.user.workflow.featureSelection

import cats.effect.SyncIO
import japgolly.scalajs.react.vdom.all._
import scalatags.Text.TypedTag
import shared.Pojo._
import myJs.myPkg.jquery._
import myJs.Implicits._
import myJs.myPkg.reactHookForm.{ReactHookForm, UseFieldArrayOptions, UseFieldArrayRT, UseFormRT}
import myJs.tool.Tool
import myJs.tool.Tool._
import myJs.user.workflow.featureSelection.boruta.Boruta
import myJs.user.workflow.featureSelection.cor.Cor
import myJs.user.workflow.featureSelection.diagnoseAna.DiagnoseAna
import myJs.user.workflow.featureSelection.preprocess.Preprocess
import myJs.user.workflow.featureSelection.intersect.Intersect
import myJs.user.workflow.featureSelection.oplsda.Oplsda
import myJs.user.workflow.featureSelection.pathwayAna.PathwayAna
import myJs.user.workflow.featureSelection.pca.Pca
import myJs.user.workflow.featureSelection.plsda.Plsda
import myJs.user.workflow.featureSelection.rf.Rf
import myJs.user.workflow.featureSelection.svm.Svm
import myJs.user.workflow.featureSelection.uniAna.UniAna
import myJs.user.workflow.featureSelection.union.Union
import shared.pojo.WorkflowMission.{ExtraData, FsData}

/** Created by yz on 2/12/2020
  */
object AllFSSoft {

  val softs =
    List(UniAna, Preprocess, Oplsda, Intersect, Rf, Svm, Union, Boruta, DiagnoseAna, Plsda, Cor, PathwayAna, Pca)

  val fieldArraySofts = softs.filter { x =>
    x != Preprocess
  }

  val kindSoftMap = softs.map { x =>
    (x.nameStr, x)
  }.toMap

  trait FSSoftT extends SoftT {

    def refreshResult(idStr: String) = {}

    def cp(
      fieldArray: UseFieldArrayRT,
      fsData: FsData,
      fsDataChange: FsData => SyncIO[Unit],
      fsDataModifyF: (FsData => FsData) => SyncIO[Unit],
      showIdStr: String,
      extraData: ExtraData,
      extraDataChange: ExtraData => SyncIO[Unit]
    ): VdomNode = EmptyVdom

    def appendData(
        fieldArray: UseFieldArrayRT,
        fsData: FsData,
        fsDataChange: FsData => SyncIO[Unit],
        nodeId: String,
        extraData: ExtraData
    ):SyncIO[Unit] = SyncIO{}

    def removeData(fsData: FsData, fsDataChange: FsData => SyncIO[Unit], curI: Int):SyncIO[Unit] = SyncIO{}

    def fieldArray(useForm: UseFormRT): UseFieldArrayRT = ReactHookForm.useFieldArray(
      UseFieldArrayOptions(
        control = useForm.control,
        name = "fs"
      )
    )

  }

}
